package com.baoxin.chenxixc4coach.adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.baoxin.chenxixc4coach.fragments.TitleFragment;

import java.util.List;


public class MyViewPagerAdapter extends FragmentPagerAdapter {

    List<TitleFragment> fragments;

    public MyViewPagerAdapter(FragmentManager fm, List<TitleFragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return fragments.get(position).getTabTitle();
    }
}
